#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n = 0;
	cin >> n;
	int sum = 0;
	vector<int> v(n);
	cin >> v[0];
	int min = v[0];
	for (int i = 1; i < n; i++)
	{
		cin >> v[i];
		if (v[i] < min)
		{
			min = v[i];
		}
	}
	again:
	for (int i = 0; i < v.size(); i++)
	{
		while (v[i]>min)
		{
			v[i] /= 2;
			++sum;
		}
		if (v[i] < min)
		{
			min = v[i];
			goto again;
		}

	}
	cout << sum << endl;
	return 0;
}